package com.hnkywl.sts.action.cwgl.kmys;

import com.hnkywl.sts.entity.organ.Gsjg;
import com.hnkywl.sts.entity.organ.Wls;
import com.hnkywl.sts.service.organ.GsjgService;
import com.hnkywl.sts.service.organ.WlsService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created with IntelliJ IDEA.
 * User: ccr
 * Date: 13-7-7
 * Time: 下午2:59
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/cwgl/kmys/wlskmdmys")
public class WlskmdmysAction extends SimpleActionSupport{
    private WlsService wlsService;
    //公司机构
    private Wls wls;
    //科目代码
    private String kmdm;
    private String qc;
    private String jc;
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows;

    @Action("wlskmdmysList")
    public void gsjgKmdmys(){
        renderJson(this.wlsService.findKmdm(qc, jc, page, rows));
    }

    @Action("save")
    public void saveKmdm(){
        try{
            wlsService.saveKmdm(wls);
            renderJson("{\"statusCode\":200}");
        }catch (Exception  e) {
            e.printStackTrace();
            renderJson("{\"statusCode\":300,\"message\":\""+e.getMessage()+"\"}");
        }
    }

    public Wls getWls() {
        return wls;
    }

    public void setWls(Wls wls) {
        this.wls = wls;
    }

    public String getKmdm() {
        return kmdm;
    }

    public void setKmdm(String kmdm) {
        this.kmdm = kmdm;
    }

    public String getQc() {
        return qc;
    }

    public void setQc(String qc) {
        this.qc = qc;
    }

    public String getJc() {
        return jc;
    }

    public void setJc(String jc) {
        this.jc = jc;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    @Autowired
    public void setWlsService(WlsService wlsService) {
        this.wlsService = wlsService;
    }
}
